<template>
	<view style="background-color: #F3F4F5;height: 100vh;"> 
		<view class="reBox">
			<view class="czje">
				充值金额
			</view>
			<view class="flex_r_start">
				<view class="dw">￥</view>
				<view class="input">
					<input type="number" v-model="money" />
				</view>
			</view>
		</view>
		<view class="" style="margin-top: 20rpx;"> 
			<!-- <view class="item flex_r_between" style="border-bottom: 1px solid #DDDDDD;" @click="type=2">
				<view class="fonts flex_item_center">
					<image style="width: 40rpx;height: 40rpx;margin-right: 24rpx;" src="../../static/spokesmanImg/icon/zfb.png" mode=""></image>支付宝支付
				</view>
				<view>
					<image v-show="type===2?true:false" style="width: 32rpx;height: 32rpx;" src="../../static/spokesmanImg/icon/selected_on.png" mode=""></image>
					<image v-show="type!==2?true:false" style="width: 32rpx;height: 32rpx;" src="../../static/spokesmanImg/icon/selected_on1.png" mode=""></image>
				</view>
			</view> -->
			<view class="item flex_r_between"  @click="type=3">
				<view class="fonts flex_item_center">
					<image style="width: 40rpx;height: 40rpx;margin-right: 24rpx;" src="../../static/spokesmanImg/icon/wx.png" mode=""></image>微信支付
				</view>
				<view>
					<image v-show="type===3?true:false" style="width: 32rpx;height: 32rpx;" src="../../static/spokesmanImg/icon/selected_on.png" mode=""></image>
					<image v-show="type!==3?true:false" style="width: 32rpx;height: 32rpx;" src="../../static/spokesmanImg/icon/selected_on1.png" mode=""></image>
				</view>
			</view>
		</view>
		<view class="ljfk flex_r_between">
			<view class="yf">
				应付：<span>￥{{money===''?0:money}}</span>
			</view>
			<view class="ljfkbtn"  @click="recharge">立即付款</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:3,
				money:'',
			};
		},
		methods:{
			recharge(){
				this.$request('/app/user/recharge','post',{
					access_token:uni.getStorageSync('access_token').replace(/^\"|\"$/g,''),
					type:this.type,
					money:this.money
				}).then(res=>{
					uni.requestPayment({
					    provider: 'wxpay',
					    timeStamp: JSON.stringify(res.content.timestamp),
					    nonceStr: res.content.noncestr,
					    package: 'prepay_id='+res.content.prepayid,
					    signType: 'MD5',
					    paySign: res.content.sign,
					    success: function (res) {
					        console.log('success:' ,res);
					    },
					    fail: function (err) {
					        console.log(err);
					    }
					});
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import url("@/static/css/flex.css");
	.ljfk{
		position: fixed;
		bottom: 0;
		z-index: 99;
		width: 100%;
		height: 98rpx;
		background: #FFFFFF;
		// border-top: 1px solid #DDDDDD;
		padding: 0 22rpx;
		box-sizing: border-box;
		.yf{
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #111111;
			span{
				font-size: 32rpx;
				font-family: PingFangSC-Semibold, PingFang SC;
				font-weight: 600;
				color: #DB1B22;

			}

		}
		.ljfkbtn{
			width: 230rpx;
			height:70rpx;
			background: #DB1B22;
			border-radius: 36rpx;
			font-size: 30rpx;
			font-family: PingFangSC-Semibold, PingFang SC;
			font-weight: 600;
			color: #FFFFFF;
			line-height: 70rpx;
			text-align: center;
		}
	}
	.item{
		height: 100rpx;
		padding: 0 40rpx;
		background-color: #fff;
		.fonts{
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #111111;

		}
	}
	.reBox{
		width: 100%;
		height: 300rpx;
		background: #FFFFFF;
		padding: 28rpx 32rpx;
		box-sizing: border-box;
		.czje{
			font-size: 32rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #111111;

		}
		.dw{
			width: 24px;
			height: 33px;
			font-size: 48rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #111111;
			margin-top: 115rpx;
		}
		.input{
			font-size: 100rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #111111;
			margin-top: 50rpx;
			margin-left: 20rpx;
			input{
				height: 100%;
				border-bottom: 1px solid #DDDDDD;
			}
		}
	}
</style>
